/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.CapEntityManager.teste;

import br.com.CapEntityManager.Estado5;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author egberto
 */
public class TesteCarregamentoRelacionamento {
    
    public static void main(String args[]){
        EntityManagerFactory factory = Persistence.createEntityManagerFactory("default");
        EntityManager manager = factory.createEntityManager();
        
        Estado5 estado = manager.find(Estado5.class, 1L);
        
        manager.close();
        factory.close();
        
        System.out.println(estado.getGovernador().getNome());
    }
    
}
